﻿// libuvtest.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include <iostream>
#include <conio.h>
#include <vld.h>
#include "molenet.h"

int main(int argc, char* argv[])
{
	InitMolNet(argc,argv);

	std::map<std::string, std::string> pparams;

	if ((argc - 1) % 2 == 0)
	{
		int paramcount = (argc - 1) / 2;

		for (int i = 0; i < paramcount; i++)
		{
			pparams[argv[(i + 1)+i*2]] = argv[(i + 1) + i * 2 + 1];
		}
	}

	int port = 1884;
	int dport = 1885;

	std::map<std::string, std::string>::iterator iter = pparams.find("-port");
	if (iter != pparams.end())
		port = atoi((*iter).second.c_str());
	iter = pparams.find("-dport");
	if (iter != pparams.end())
		dport = atoi((*iter).second.c_str());

	StartMolNet("0.0.0.0", port, dport);

	CleanMolNet();
}
